const nunjucks = require('nunjucks');
const fs = require('fs');
const path = require('path');

// 配置Nunjucks
const env = nunjucks.configure({
  autoescape: true,
  watch: false
});

// 编译index.njk为index.html
try {
  const result = nunjucks.render('index.njk');
  fs.writeFileSync('index.html', result);
  console.log('编译成功：', new Date().toLocaleTimeString());
} catch (err) {
  console.error('编译错误：', err.message);
}